package com.jz.listener;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;

import com.jz.dao.ModelDAO;
import com.jz.mm.ModelMm;
import com.jz.model.Model;


public class ApplicationInit {
	private static final Log log = LogFactory.getLog(WebStartupListener.class);
	
	public static void initDataCake(ApplicationContext ctx) {
		ModelDAO modelDAO = (ModelDAO) ctx.getBean("modelDAO");
		ModelMm modelMm = (ModelMm) ctx.getBean("modelMm");
		List<Model> models = modelDAO.getModels();
		for (Model model : models) {
			modelMm.insert(model);
		}
	}
}
